<?php
Yii::app()->clientScript->registerCoreScript('jquery');?>



<style>
    .content-wrapper label {
        font-size: 33px;
    }

    a {
        text-decoration: none;
    }

    .pagination ul {
        list-style: none;
    }

    .pagination ul li {
        display: inline;
    }

    .pagination ul li a {
        padding: 10px;
    }

    .pagination ul li.active {
        text-decoration: underline;
    }

</style>

<div class="content-wrapper">

    <?php if (count($model) == 0)
        echo "Không tìm thấy sản phẩm";
    else {
        ?>
        <div id="divPrint">
            <img alt="print" src="<?php echo HSUrl::home() . '/images/printer.png' ?>" title="Print">
            <label id="print">Print</label>
        </div>
        <?php
        $index = 0;
        foreach ($model as $k => $item) {
            $index = $index + 1;
            if ($k != count($model) - 1) {
                $border = "border-top: 5px solid gray;border-left: 5px solid gray;border-right: 5px solid gray;";
            } else {
                $border = "border-top: 5px solid gray;border-left: 5px solid gray;border-right: 5px solid gray;border-bottom: 5px solid gray;";
            }

            if ($index == 4) {
                $border .= "border-bottom: 5px solid gray;";
                $index = 0;
            }
            ?>

            <div style=" <?php echo $border ?>padding:0 20px;min-height: 470px;line-height: 42px">
                <div>
                    <label style="font-size: 53px;line-height: 60px;font-weight: bold">
                        <?php echo $item->name ?>
                    </label>
                </div>
                <div style="clear: both"></div>
                <div style="float: left;min-width: 60%;max-width: 60%;">
                    <p>

                        <?php if ($item->code != '') { ?>
                    <div>
                        <label>Code: </label><label><?php echo $item->code ?></label>
                    </div>
                    <?php } ?>

                    <?php if ($item->model != '') { ?>
                        <div>
                            <label>Model: </label>
                            <label><?php echo $item->model ?></label>
                        </div>
                    <?php } ?>
                    </p>

                    <p>

                        <label>Giá bán: </label>
                        <label style="font-size: 55px"><?php echo $item->price ?></label>
                        <br/>
                        <label>Tình trạng: </label>
                        <label> <?php echo $item->status ?></label>
                    </p>
                    <p>

                        <label>Nhận gửi hàng: </label>
                        <label><?php echo $item->shipping_method ?></label>
                        <br/>
                        <label>Trả tiền online: </label>
                        <label><?php echo $item->pay_online ?></label>

                        <br/>
                        <label>Liên lạc phone: </label>
                        <label><?php echo $item->phone ?></label>
                </div>
                </p>
                <div
                    style="float: left; min-height: 300px;max-width: 300px;margin-right: 15px;width: 30%;text-align: center;position: relative;padding: 7px">
                    <img src="<?php echo HSUrl::home() . "/$item->picture" ?>" alt=""
                         style="max-height: 300px;max-width: inherit;position: absolute;top:0;left: 0;right: 0;bottom: 0;margin: auto"/>
                </div>
                <div style="clear: both"></div>

            </div>

        <?php
        }?>

    <?php
    }
    ?>

</div>

<script type="text/javascript">
    $(document).ready(function () {
        $('#print').click(function () {
            var $print = $("#divPrint");
            var $pagination = $(".pagination");

            $print.attr('style', 'display:none');
            $pagination.attr('style', 'display:none');

            window.print();
            $print.attr('style', 'display:block');
            $pagination.attr('style', 'display:block');
            return false;
        });
    });
</script>